From b6cd10140c7d93c8ccf168c13a8455f2e878639c Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 19 Aug 2009 13:11:33 +0100 Subject: [PATCH] hotplug scripts: better same_vm checks currently the function same_vm in block-common.sh is the one responsible for detecting if two block devices can be used at the same time by two VMs. This can be allowed in few specific cases: when the two VMs are actually the same VM and when the two VMs are the guest and its stubdomain. We need to expand these exceptions to handle properly save restore issues: this patch adds to the exceptions the case when two VMs are the same VM because of save\restore races, and when two VMs are the guest and the stubdomain of the previous guest, again during save\restore. Signed-off-by: Stefano Stabellini --- tools/hotplug/Linux/block-common.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/hotplug/Linux/block-common.sh b/tools/hotplug/Linux/block-common.sh index efedbf50d4..cc374efeb4 100644 --- a/tools/hotplug/Linux/block-common.sh +++ b/tools/hotplug/Linux/block-common.sh @@ -112,6 +112,14 @@ same_vm() "$FRONTEND_UUID") local target=$(xenstore_read_default "/local/domain/$FRONTEND_ID/target" \ "-1") - [ "$FRONTEND_UUID" = "$othervm" -o "$target" = "$otherdom" ] + local otarget=$(xenstore_read_default "/local/domain/$otherdom/target" \ + "-1") + local otvm=$(xenstore_read_default "/local/domain/$otarget/vm" \ + "-1") + otvm=${otvm%-1} + othervm=${othervm%-1} + local frontend_uuid=${FRONTEND_UUID%-1} + + [ "$frontend_uuid" = "$othervm" -o "$target" = "$otherdom" -o "$frontend_uuid" = "$otvm" ] } -- 2.30.2